<?php
/**
 * @var \Phalcon\Mvc\View\Engine\Php $this
 */
?>
<?php $param=['url'=>$this->url->get('index/store'),'ement'=>'修改']?>
<!--  面包屑-->
<?= $this->partial('layouts/pathtag')?>

<p><?php $this->flashSession->output() ?></p>

<?= $this->tag->form(["index/create","method"=>'post','id'=>'userForm']) ?>
  <div class="form-group">
    <label  >用户名</label>
    <?= $this->tag->textField(['userName','class'=>"form-control",'name'=>"userName",'placeholder'=>"用户名"]);?>
    <label class="error" ><?= $userName=empty($mes['userName']['mes'])?'':$mes['userName']['mes']?> </label>
  </div>
  <div class="form-group">
    <label  >邮箱</label>
    <?= $this->tag->textField(['emai','class'=>"form-control",'name'=>"emai",'placeholder'=>"邮箱"]);?>
    <label class="error" ><?= $emai=empty($mes['emai']['mes'])?'':$mes['emai']['mes']?>  </label>

  </div>
  <div class="form-group">
    <label  >密码</label>
    <?= $this->tag->passwordField(['password','class'=>"form-control",'name'=>"password",'placeholder'=>"密码"]);?>
    <label class="error" ><?= $password=empty($mes['password']['mes'])?'':$mes['password']['mes']?>  </label>
  </div>
  <div class="form-group">
    <label  >重复密码</label>
    <?= $this->tag->passwordField(['password','class'=>"form-control",'name'=>"repassword",'placeholder'=>"重复密码"]);?>
    <label class="error"> <?= $password=empty($mes['repassword']['mes'])?'':$mes['repassword']['mes']?> </label>
  </div>

  <div class="form-group">
    <?=$this->tag->submitButton(['保 存','class'=>'btn btn-info'])?>
  </div>

<?=$this->tag->endForm()?>
<script>
  $(function () {

  var validate = $("#userForm").validate({
    debug: false, //调试模式取消submit的默认提交功能
    errorClass: "error", //默认为错误的样式类为：error
    focusInvalid: false, //当为false时，验证无效时，没有焦点响应
    onkeyup: false,
    submitHandler: function(form){   //表单提交句柄,为一回调函数，带一个参数：form
      form.submit();   //提交表单
    },

    rules:{
      userName:{
        required:true
      },
      emai:{
        required:true,
        email:true
      },
      password:{
        required:true,
        rangelength:[3,10]
      },
      repassword:{
        equalTo:"#password"
      }
    },
    messages:{
      myname:{
        required:"必填"
      },
      email:{
        required:"必填",
        email:"E-Mail格式不正确"
      },
      password:{
        required: "不能为空",

      },
      confirm_password:{
        equalTo:"两次密码输入不一致"
      }
    }

     });

   });

</script>
